﻿@model IList<yq.IBase.Table.TableInfo>
<script>
    var webUrl = '@Url.Action("CreateCode")';
    var createIoConfig = '@Url.Action("CreateIoConfig")';
</script>
<script>
    var currId = "";
    function onUpdateColoer(col)
    {
        try
        {
            $("a[name='xuanz']").each(function (obj)
            {
                if ($(col).attr("infocode") == $(this).attr("infocode"))
                {
                    $(this).attr("style", "color:Red");
                } else
                {
                    $(this).attr("style", "");
                }
            });
            currId = $(col).attr("infocode");
            onSelect();
        } catch (e)
        {
            alert(e);
        }
        return false;
    }

    //选择
    function onSelect()
    {
        if (currId.length == 0)
            return false;

        var typename = "";
        $("input[name='dyq']").each(function ()
        {
            if ($(this).attr("checked"))
            {
                typename = $(this).val();
            }
        });

        $.ajax({
            url: webUrl, data: { name: currId, typename: typename },
            success: function (data)
            {
                $("#txt_contxt").val(data);
            }
        });
    }

    //生成配置文件
    function onIoConfig()
    {

        $.ajax({
            url: createIoConfig, data: {},
            success: function (data)
            {
                $("#txt_contxt").val(data);
            }
        });
    }

</script>
<table width="100%">
    <tr>
        <td>
        </td>
        <td>
            <label>
                <input type="radio" value="CreateModel" onclick=" onSelect() " name="dyq" checked />
                实体继承类
            </label>
          @*  <label>
                <input type="radio" value="CreateIModel" onclick=" onSelect() " name="dyq" />
                实体父类
            </label>*@
            <label>
                <input type="radio" value="CreateDAL" onclick=" onSelect() " name="dyq" />
                数据库访问继承类
            </label>
            <label>
                <input type="radio" value="CreateEnum" onclick=" onSelect() " name="dyq" />
                Enum
            </label>
            <label>
                <input type="radio" value="CreateSqlite" onclick=" onSelect() " name="dyq" />
                Sqlite触发器
            </label>
            <label>
                <input type="radio" value="CreateMsSQL" onclick=" onSelect() " name="dyq" />
                MS-SQL触发器
            </label>
            <label>
                <a href='#' onclick=" onIoConfig();return false;">IoConfig生成 @Html.Raw("&nbsp;")</a>
            </label>
            <a href='@Url.Action("ToCode")' target="_blank">批量生成</a>
        </td>
    </tr>
    <tr>
        <td>
            @foreach (var info in Model)
            {
                <p>
                    <a   href="#" name="xuanz" infocode="@info.ClassName" onclick="return onUpdateColoer(this)" >@info.ClassName</a>
                </p> 
            }
        </td>
        <td style="width: 80%">
            <textarea id="txt_contxt" style="width: 100%; height: 100%"> </textarea>
        </td>
    </tr>
</table>
<div>
</div>
